package com.ruoyi.web.controller.wx;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.domain.WxVo.WxInfo;
import com.ruoyi.web.service.WxLoginService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
* @Project: serve
* @Package com.ruoyi.web.controller.wx
* @Description: TODO(这里用一句话描述这个类的作用)
* @author : GuitarXiaohe
* @date Date : 2023年10月27日 09:46
* @version V1.0
*/

@RestController
@RequestMapping("/wx")
public class WxLoginController {

    @Resource
    private WxLoginService wxLoginService;

    /**
     * 微信登录
     *
     * @return
     */
    @ApiOperation("微信登录")
    @Log(title = "微信登录", businessType = BusinessType.GRANT)
    @PostMapping("/login")
    public AjaxResult wxLogin(@RequestBody WxInfo wx) {
        return wxLoginService.wxLogin(wx);
    }


    /**
     * 微信注册
     *
     * @return
     */
    @PostMapping("/re")
    @ApiOperation("微信注册")
    @Log(title = "微信注册,授权手机号", businessType = BusinessType.GRANT)
    public AjaxResult wxRe(@RequestBody WxInfo wx) throws Exception {
        return wxLoginService.wr(wx);

    }
}